package com.zzw.bridge.common.page;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 分页对象
 *
 * @author other
 * @date 2024/1/1 12:00
 */
@Data
public class Pages {

  @ApiModelProperty(value = "页码", example = "1")
  private Integer page;

  @ApiModelProperty(value = "条目数", example = "10")
  private Integer size;

  @ApiModelProperty(value = "排序字段")
  private String sortField;

  @ApiModelProperty(value = "排序字段方式 1:升序 ASC / 2:降序 DESC",example = "2")
  private Integer sortMode;

  @ApiModelProperty(value = "排序字段描述方式")
  private  String sortDes;

  @ApiModelProperty(value = "起始页")
  private Long startRow;

  public Integer getPage() {
    return this.page == null || this.page == 0 ? 1 : this.page;
  }

  public Integer getSize() {
    return this.size == null || this.size == 0 ? 10 : this.size;
  }

  public Pages() {}

  public Pages(Integer thisPage, Integer thisSize) {
    this.page = thisPage;
    this.size = thisSize;
  }
}
